<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>右下角悬浮框</title>
    <style>
        #div1{width: 100px;height: 100px;background: red;position: absolute;
            left: 0;bottom: 0;
        }
        body{height: 2000px;}
    </style>
    <script>
        /*
            onscroll: 当页面滚动的时候发生
            on
        */
        window.onscroll = window.onresize = function(){
            var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
            var oDiv = document.getElementById('div1');
            oDiv.style.top = document.documentElement.clientHeight - oDiv.offsetHeight + scrollTop + 'px';
            //滑动时div会抖动：
            //思路：
            //用navigator.UserAgent版本浏览器---> IE 则用 fixed(固定定位)
            //                           否则 用运动
        }
    </script>
</head>
<body>
    <div id="div1">

    </div>
</body>
</html>